import flash.display.Sprite;
import flash.display.Shape;
import flash.events.Event;
import flash.text.TextField;
import flash.geom.Rectangle;

class VectorTextView extends Sprite
{
  private var _v1:VectorModel;
  
  public var Text:RotationText;

  private var _camera:Rectangle;
  
  public function new(vector:VectorModel, camera:Rectangle) 
  {
    super();
    _camera = camera;
    this._v1 = vector;
    _v1.addEventListener(Event.CHANGE, onChange);
    Text = new RotationText();
    addChild(Text);
  }
  //onChange  is called by the VectorModel's update method
  
  public function onChange(event:Event)
  {
    //Find the new vector coordinates
    
    Text.x = _v1.a.x;
    //Text.width = _v1.b.x-_v1.a.x;
    
    Text.y = _v1.a.y;
    Text.rotation = _v1.angle;

  }

}